package com.app.qbake.util;

import android.app.Activity;

import com.aliyun.common.httpfinal.QupaiHttpFinal;
import com.aliyun.demo.recorder.AliyunVideoRecorder;
import com.aliyun.struct.common.VideoQuality;
import com.aliyun.struct.recorder.CameraType;
import com.aliyun.struct.recorder.FlashType;
import com.aliyun.struct.snap.AliyunSnapVideoParam;

/**
 * Created by wind on 2017/7/27.
 */

public class AliPaiUtil {
    public static void init(){

        System.loadLibrary("live-openh264");
        System.loadLibrary("QuCore-ThirdParty");
        System.loadLibrary("QuCore");
        QupaiHttpFinal.getInstance().initOkHttpFinal();
    }


    public static void startRecordForResult(Activity activity,int requestCode){
        AliyunVideoRecorder.startRecordForResult(activity,requestCode,getRecordParam());
    }
    public static AliyunSnapVideoParam getRecordParam(){
        AliyunSnapVideoParam recordParam = new AliyunSnapVideoParam.Builder()
                //设置录制分辨率，目前支持360p，480p，540p，720p
                .setResulutionMode(AliyunSnapVideoParam.RESOLUTION_540P)
                //设置视频比例，目前支持1:1,3:4,9:16
                .setRatioMode(AliyunSnapVideoParam.RATIO_MODE_3_4)
                .setRecordMode(AliyunSnapVideoParam.RECORD_MODE_AUTO) //设置录制模式，目前支持按录，点录和混合模式
                //.setFilterList(eff_dirs) //设置滤镜地址列表,具体滤镜接口接收的是一个滤镜数组
                .setBeautyLevel(80) //设置美颜度
                .setBeautyStatus(true) //设置美颜开关
                .setCameraType(CameraType.FRONT) //设置前后置摄像头
                .setFlashType(FlashType.ON) // 设置闪光灯模式
                .setNeedClip(true) //设置是否需要支持片段录制
                .setMaxDuration(10000) //设置最大录制时长 单位毫秒
                .setMinDuration(3000) //设置最小录制时长 单位毫秒
                .setVideQuality(VideoQuality.HD) //设置视频质量
                //.setGop(gop) //设置关键帧间隔
                .build();
        return recordParam;
    }


}
